package com.xpjhs.user.web.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xpjhs.user.model.User;
import com.xpjhs.user.service.UserService;
/**
 * 
 * @ClassName:UserContorller
 * @Description:{todo}
 * @author luckyboyguo@126.com
 * @date:2015年1月16日上午10:30:44
 */
@Controller
@RequestMapping("/user")
public class UserContorller {

	@Autowired
	private UserService userService;
	@RequestMapping("/list")
	public String list(HttpServletRequest request,ModelMap model){
		List<User>users=userService.listAllUsers();
		for (User user : users) {
			System.out.println("真实姓名为:"+user.getRealName());
		}
		return null;
	}
	@RequestMapping("/listUserPage")
	public String listUserPage(HttpServletRequest request,ModelMap model){
		Pageable page=new PageRequest(1, 3);
		Page<User>users=userService.listUserPage(page);
		for (User user : users.getContent()) {
			System.out.println("真实姓名为："+user.getRealName());
		}
		return null;
	}
	@RequestMapping("/saveUser")
	public String saveUser(HttpServletRequest request,ModelMap model){
		
		return null;
	}
	@RequestMapping("/userinfo")
	public String userInfo(HttpServletRequest request,ModelMap model){
		
		return "user.userinfo";
	}
}
